<template>
  <div class="tousu">
    <Card :bordered="false">
      <p slot="title"
         class="white">待办事项 > <span class="select-font">河流事件</span>
      </p>
      <div style="position:relative;">
        <Form :model="searchItem"
              class="smallForm">
          <Input v-model="searchItem.river_name"
                 style="width:19%;margin-right: 15px;"
                 :maxlength="20"
                 placeholder="请输入河流名称" />
          <Input v-model="searchItem.contacts"
                 style="width:19%;margin-right: 15px;"
                 :maxlength="20"
                 placeholder="请输入事件上报人名称" />
          <Input v-model="searchItem.report_no"
                 style="width:19%;margin-right: 15px;"
                 :maxlength="20"
                 placeholder="请输入事件编号" />
          <Input v-model="searchItem.overday"
                 style="width:19%;margin-right: 15px;"
                 :maxlength="20"
                 placeholder="请输入超时天数" />
          <DatePicker @on-change="change"
                      format="yyyy-MM-dd"
                      type="daterange"
                      placeholder="请选择事件日期"
                      style="width: 19%;margin: 15px 15px 0 0;"></DatePicker>
          <dep-select @getData="getDepData"
                      style="width:19%;margin-right: 15px;"></dep-select>
          <area-select @getData="getAreaData"
                       style="width:19%;margin-right: 15px;" />
          <Checkbox v-model="searchItem.is_multiple">是否为多次事件河流</Checkbox>
          <Checkbox v-model="searchItem.my_respon">只显示本部门</Checkbox>
        </Form>
        <Button type="info"
                style="position:absolute;top:0;right:15%"
                @click="getComplaint('1',type_solve_is)">搜索</Button>
      </div>
    </Card>
    <Tabs v-model="topTabs"
          @on-click="aa">
      <TabPane label="处理中"
               name="处理中">
        <Table ref="table"
               :row-class-name="rowClassName"
               :data="comfirmData"
               :columns="complaintColumns"
               stripe
               :height="600"></Table>
      </TabPane>
      <TabPane label="已处理"
               name="已处理">
        <Table ref="table"
               :data="completeData"
               :columns="complaintColumns"
               stripe></Table>
      </TabPane>
      <TabPane label="手动录入投诉"
               name="手动录入投诉">
        <Form ref="JNoteForm"
              :model="formItem3"
              :label-width="120">
          <i-col span="6"
                 offset="6">
            <Form-item label="投诉人"
                       prop="contacts">
              <Input v-model="formItem3.contacts"
                     :maxlength="5"
                     placeholder="请输入投诉人"></Input>
            </Form-item>
            <Form-item label="联系方式"
                       prop="phone">
              <Input v-model="formItem3.phone"
                     :maxlength="11 "
                     placeholder="请输入联系方式"></Input>
            </Form-item>
            <Form-item label="河湖名称（河段）"
                       prop="river_name">
              <Select v-model="formItem3.river_name"
                      placeholder="请选择河湖名称（河段）"
                      filterable
                      clearable>
                <Option v-for="item in riverName"
                        :value="item.river_no"
                        :key="item.river_no">{{ item.river_name }}</Option>
              </Select>
            </Form-item>
            <Form-item label="指派的部门"
                       prop="dep_name">
              <Select v-model="formItem3.dep_name"
                      transfer
                      filterable
                      clearable
                      placeholder="请选择部门">
                <Option v-for="item in areaArr"
                        :value="item"
                        :key="item">{{ item }}</Option>
              </Select>
            </Form-item>
          </i-col>
          <i-col span="6">
            <Form-item label="是否匿名"
                       prop="switch1">
              <i-switch v-model="switch1"></i-switch>
            </Form-item>
            <Form-item label="身份证"
                       prop="contacts_id">
              <Input v-model="formItem3.contacts_id"
                     :maxlength="20"
                     placeholder="请输入身份证" />
            </Form-item>
            <Form-item label="地点"
                       prop="address">
              <Input v-model="formItem3.address"
                     :maxlength="18"
                     placeholder="地址" />
            </Form-item>
            <Form-item label="投诉类型"
                       prop="type"
                       :rules="{required:true,message:'请选择投诉类型',trigger:'change'}">
              <Select v-model="formItem3.type"
                      clearable>
                <Option value="3"
                        selected>电话信访</Option>
              </Select>
            </Form-item>
          </i-col>
          <i-col span="12"
                 offset="6">
            <Form-item label="事件描述"
                       prop="overview">
              <Input type="textarea"
                     v-model="formItem3.overview"
                     :maxlength="800"
                     placeholder="事件描述"></Input>
            </Form-item>
            <Form-item>
              <Button type="primary"
                      @click="newReport"
                      class="pull-right">确定</Button>
            </Form-item>
          </i-col>
        </Form>
      </TabPane>
    </Tabs>
    <Page class="pull-right"
          :total="Page.total"
          :current="Page.current"
          :page-size="Page.pageSize"
          size="small"
          show-total
          @on-change="changePage"></Page>
    <Modal class="spe-modal"
           v-model="modal1"
           :mask-closable="false"
           width="1000"
           style="text-align:center;position: relative">
      <Icon type="chevron-left"
            style="font-size: 50px;position:absolute;top: 35%;left:5%;"
            @click.native="changeImge('left')"></Icon>
      <img :src="imgSrc"
           alt=""
           style="max-width: 100%;max-height: 750px;">
      <Icon type="chevron-right"
            style="font-size: 50px;position:absolute;top: 35%;right:5%;"
            @click.native="changeImge('right')"></Icon>
    </Modal>
    <Modal v-model="comfirmModal"
           title="处理事件"
           :mask-closable="false"
           width="700">
      <Form ref="comfirmForm" 
            :model="comfirmForm" 
            :rules="comfirmRules" 
            :label-width="90">
        <Form-item label="处理结果"
                   prop="solve_result">
          <Input v-model="comfirmForm.solve_result"
                 type="textarea"
                 :maxlength="800"
                 placeholder="处理结果"></Input>
        </Form-item>
        <Form-item label="不通过原因"
                   v-if="check"
                   prop="reason">
          <Input v-model="reason"
                 type="textarea"
                 :maxlength="800"
                 placeholder="不予通过"></Input>
        </Form-item>
        <Form-item label="上传图片"
                   v-if="solve" 
                   prop="photos">
          <div class="demo-upload-list"
               v-for="item in uploadList">
            <template v-if="item.status === 'finished'">
              <img :src="item.url">
              <div class="demo-upload-list-cover">
                <Icon type="ios-trash-outline"
                      @click.native="handleRemove(item)"></Icon>
              </div>
            </template>
            <template v-else>
              <Progress v-if="item.showProgress"
                        :percent="item.percentage"
                        hide-info></Progress>
            </template>
          </div>
          <Upload ref="upload"
                  :show-upload-list="false"
                  :on-success="handleSuccess"
                  :format="['jpg','jpeg','png']"
                  :max-size="2048000"
                  :on-format-error="handleFormatError"
                  :on-exceeded-size="handleMaxSize"
                  :before-upload="handleBeforeUpload"
                  multiple
                  type="drag"
                  :action="uploadUrl"
                  style="display: inline-block;width:58px;">
            <div style="width: 58px;height:58px;line-height: 58px;">
              <Icon type="ios-camera"
                    size="20"></Icon>
            </div>
          </Upload>
        </Form-item>
        <Form-item label="上传图片"
                   v-if="check">
          <div class="demo-upload-list"
               v-for="item in uploadList">
            <template>
              <img :src="item.url">
              <div class="demo-upload-list-cover">
                <Icon type="ios-eye-outline"
                      @click.native="handleView(item)"></Icon>
              </div>
            </template>
          </div>
        </Form-item>
      </Form>
      <div slot="footer">
        <Button type="primary"
                v-if="solve"
                @click="send">确定</Button>
        <Button type="primary"
                v-if="check"
                @click="review('true')">确定通过</Button>
        <Button type="error"
                v-if="check"
                @click="review('false')">不予通过</Button>
        <Button @click="comfirmModal = false">取消</Button>
      </div>
    </Modal>
    <Modal v-model="mapModal"
           width="800"
           :mask-closable="false">
      <p slot="header"
         style="color:#f60;text-align:center;float: left">
        查看地理位置
      <div>
        <img src="../../../../static/img/gis1.png"
             height="30"
             width="30"
             alt="">
        <span>上报人定位</span>
        <img src="../../../../static/img/weizhi.png"
             height="30"
             width="30"
             alt="">
        <span>上报人上报定位</span>
      </div>
      </p>
      <div v-if="mapModal"
           id="map"
           style="height: 400px">

      </div>
    </Modal>
    <Modal v-model="printModal"
           class="modal-pump"
           width="800"
           title="市河长办受理咨询投诉登记表"
           :mask-closable="false">
      <Form id="printModal"
            :model="formItem"
            :label-width="100">
        <i-col span="12">
          <Form-item label="经办人"
                     prop="confirm_person">
            <Input v-model="confirm_person"
                   :maxlength="12"
                   value="河长办" />
          </Form-item>
          <Form-item label="投诉人"
                     prop="contacts">
            <Input v-model="contacts"
                   :maxlength="5"
                   placeholder="请输入投诉人" />
          </Form-item>
          <Form-item label="联系方式"
                     prop="phone">
            <Input v-model="phone"
                   :maxlength="11 "
                   placeholder="请输入联系方式" />
          </Form-item>
          <Form-item label="河湖名称（河段）"
                     prop="river_name">
            <Input v-model="river_name"
                   :maxlength="12"
                   placeholder="请输入河湖名称（河段）" />
          </Form-item>
        </i-col>
        <i-col span="12">
          <Form-item label="登记编号"
                     prop="report_no">
            <Input v-model="report_no"
                   :maxlength="20" />
          </Form-item>
          <Form-item label="投诉时间"
                     prop="report_time">
            <Input v-model="report_time"
                   :maxlength="20"
                   placeholder="请输入投诉时间" />
          </Form-item>
          <Form-item label="身份证"
                     prop="contacts_id">
            <Input v-model="contacts_id"
                   :maxlength="20"
                   placeholder="请输入身份证" />
          </Form-item>
          <Form-item label="地点"
                     prop="address">
            <Input v-model="address"
                   :maxlength="18"
                   placeholder="地址" />
          </Form-item>
        </i-col>
        <i-col span="24">
          <Form-item label="上级督办意见"
                     prop="advice">
            <Input type="textarea"
                   readonly
                   v-model="advice"
                   :autosize="true"
                   :maxlength="800"
                   placeholder="上级督办意见" />
          </Form-item>
          <Form-item label="事件类型"
                     v-if="problem_types.length>0">
            <Input :value="problem_types.join(',')" />
          </Form-item>
          <Form-item label="事件描述"
                     prop="overview">
            <Input type="textarea"
                   v-model="overview"
                   :autosize="true"
                   :maxlength="800"
                   placeholder="事件描述" />
          </Form-item>
          <Form-item label="初步办理意见"
                     prop="complete_opinion">
            <Input type="textarea"
                   v-model="complete_opinion"
                   :autosize="true"
                   :maxlength="800"
                   placeholder="初步办理意见" />
          </Form-item>
          <Form-item label="处理结果"
                     prop="solve_result">
            <Input type="textarea"
                   v-model="solve_result"
                   :autosize="true"
                   :maxlength="800"
                   placeholder="处理结果" />
          </Form-item>
          <Form-item label="处理结果图片"
                     prop="solve_file"
                     v-if="showImgLoad.length>0">
            <div v-for="item in showImgLoad"
                 class="reprotImg">
              <img :src=" domain2+item"
                   @click="handleView(item)"
                   style="width:100%;height:100%;">
            </div>
          </Form-item>
          <Form-item label="回复处理结果"
                     prop="reply_result">
            <Input type="textarea"
                   v-model="reply_result"
                   :autosize="true"
                   :maxlength="800"
                   placeholder="回复处理结果" />
          </Form-item>
          <Form-item label="处理效率评分"
                     v-show="user_type === '1'"
                     prop="score">
            <Rate disabled
                  v-model="score.speed" />
          </Form-item>
          <Form-item label="回复态度评分"
                     v-show="user_type === '1'"
                     prop="score">
            <Rate disabled
                  v-model="score.attitude" />
          </Form-item>
          <Form-item label="综合得分评分"
                     v-show="user_type === '1'"
                     prop="score">
            <Rate disabled
                  v-model="score.merge" />
          </Form-item>
          <Form-item label="群众评价"
                     v-show="user_type === '1'"
                     prop="score">
            <div>{{score.evaluate}}</div>
          </Form-item>
        </i-col>
        <i-col span="24">
          <Table ref="table"
                 :data="jinduData"
                 :columns="jinduColumns"
                 stripe></Table>
        </i-col>
      </Form>
      <div slot="footer">
        <Button type="info"
                v-if="printshow"
                @click="drawImg">导出图片</Button>
        <Button type="primary"
                v-if="printshow"
                @click="ok">下载表格</Button>
        <Button @click="printModal = false">取消</Button>
      </div>
    </Modal>

    <Modal v-model="assignDownModal"
           title="下派"
           :mask-closable="false"
           width="600">
      <Tabs v-model="chrefTabs"
            @on-click="bb">
        <TabPane label="指派河长办"
                 name="指派河长办">
          <Form :model="formItem1"
                :label-width="80">
            <Form-item label="选择河长办"
                       prop="dep_name">
              <Select clearable
                      transfer
                      v-model="dep_name">
                <Option v-for="item in depList"
                        :value="item.dep_name"
                        :key="item.dep_name">{{ item.dep_name }}</Option>
              </Select>
            </Form-item>
          </Form>
        </TabPane>
      </Tabs>
      <div slot="footer">
        <span v-show="userType == 4 && userLevel == 3"
              class="pull-left"><span style="color: #FF4040">温馨提醒</span>:河长办经办人指派给村河长处理，走村河长流程。</span>
        <Button type="primary"
                @click="assignDown">确认</Button>
        <Button @click="assignDownModal = false">取消</Button>
      </div>
    </Modal>
    <Modal v-model="backModal"
           :mask-closable="false"
           width="500">
      <p slot="header"
         style="color:#f60;text-align:center">
        <Icon type="information-circled"></Icon>
        <span>撤销分派</span>
      </p>
      <div style="text-align:center">
        <p>确认撤销分派？</p>
        <Form :model="formItem1"
              :label-width="80">
          <Form-item label="返回原因"
                     prop="reason">
            <Input v-model="formItem1.reason"
                   type="textarea"
                   :maxlength="800"
                   placeholder="请填写撤销原因"></Input>
          </Form-item>
        </Form>
      </div>
      <div slot="footer">
        <Button type="error"
                size="large"
                long
                @click="backDep">确认</Button>
      </div>
    </Modal>
    <Modal v-model="tuisongModal"
           @on-ok="sendToPro"
           :mask-closable="false"
           title="推送事件到省"
           width="700">
      <Form :model="formItem1"
            :label-width="80">
        <Form-item label="选择河流">
          <Select clearable
                  v-model="ts_river">
            <Option v-for="item in tsRiverList"
                    :value="item.province_rivercode"
                    :key="item.province_rivercode">{{ item.province_rivername }}</Option>
          </Select>
        </Form-item>
        <Form-item label="选择类型">
          <Select clearable
                  v-model="ts_type">
            <Option v-for="item in tsTypeList"
                    :value="item.title"
                    :key="item.title">{{ item.title }}</Option>
          </Select>
        </Form-item>
      </Form>
    </Modal>
    <Modal v-model="backModal2"
           :mask-closable="false"
           width="500">
      <p slot="header"
         style="color:#f60;text-align:center">
        <Icon type="information-circled"></Icon>
        <span>上报确认</span>
      </p>
      <div style="text-align:center">
        <p>确认上报上级河长办？</p>
        <p style="margin-bottom: 15px">是否继续上报？</p>
        <Form :model="formItem1"
              :label-width="80">
          <Form-item label="上报原因"
                     prop="reason">
            <Input v-model="formItem1.reason"
                   type="textarea"
                   style="width: 95%"
                   :maxlength="800"
                   placeholder="请填写上报原因"></Input><span class="redStar">*</span>
          </Form-item>
        </Form>
      </div>
      <div slot="footer">
        <Button type="error"
                size="large"
                long
                @click="backDep2">确认</Button>
      </div>
    </Modal>
    <Modal v-model="companyModal"
           :mask-closable="false"
           title="指派主办单位和协办单位"
           width="600">
      <Form :model="formItem1"
            :label-width="80">
        <Form-item label="主办单位"
                   prop="host_dep">
          <Select clearable
                  v-model="host_dep">
            <Option v-for="item in host_depList"
                    :value="item"
                    :key="item">{{ item }}</Option>
          </Select>
        </Form-item>
        <Form-item label="协办单位"
                   prop="assist_dep">
          <Select multiple
                  v-model="assist_dep">
            <Option v-for="item in host_depList"
                    :value="item"
                    :key="item">{{ item }}</Option>
          </Select>
        </Form-item>
        <Form-item label="指派建议"
                   v-if="host_dep != ''"
                   prop="chief_advice">
          <Input v-model="chief_advice"
                 type="textarea"
                 style="width: 95%"
                 :maxlength="800"
                 placeholder="请输入指派建议" /><span class="redStar">*</span>
        </Form-item>
      </Form>
      <div slot="footer">
        <Button type="primary"
                @click="assDep">确认</Button>
        <Button @click="companyModal = false">取消</Button>
      </div>
    </Modal>
    <Modal title="查看处理结果图片"
           class="spe-modal"
           :mask-closable="false"
           v-model="visible">
      <img :src="domain2+imgName"
           v-if="visible"
           style="width: 100%">
    </Modal>
    <Modal v-model="comfirmModal1"
           :mask-closable="false"
           title="提交处理意见"
           width="700">
      <Form :model="formItem1"
            :label-width="100">
        <Form-item label="选择审核河长"
                   prop="username1">
          <Select clearable
                  filterable
                  ref="SHselect"
                  transfer
                  v-model="username1">
            <OptionGroup :label="v.rolename"
                         v-for="v in userList"
                         :key="v.rolename">
              <Option v-for="item in v.users"
                      :value="item.username"
                      :key="item.username">{{ item.realname }}</Option>
            </OptionGroup>
          </Select>
        </Form-item>
        <Form-item label="处理意见"
                   prop="chref_complete_opinion">
          <Input v-model="chref_complete_opinion"
                 type="textarea"
                 :maxlength="800"
                 placeholder="处理意见" />
        </Form-item>
      </Form>
      <div slot="footer">
        <span v-show="userType == 4 && userLevel == 3"
              class="pull-left"><span style="color: #FF4040">温馨提醒</span>:经办人提交处理意见，给负责人与镇级河长审核。（该按钮只能指派镇级河长）</span>
        <Button type="primary"
                @click="examine">确认</Button>
        <Button @click="comfirmModal1 = false">取消</Button>
      </div>
    </Modal>
    <lc :row="saveRow"
        ref="lc"></lc>
    <pictures ref="pictures"></pictures>
    <Modal v-model="replyModal"
           :mask-closable="false"
           title="回复处理结果"
           @on-ok="reply"
           width="600">
      <Form :model="formItem2"
            :label-width="120">
        <Form-item label="回复处理结果"
                   prop="reply2">
          <Input v-model="reply2"
                 type="textarea"
                 :autosize="true"
                 placeholder="回复处理结果" />
        </Form-item>
      </Form>
    </Modal>
    <Modal v-model="modalDel"
           :mask-closable="false"
           title="提示"
           @on-ok="confirmDel"
           @on-cancel="modalDel = false">
      <p>确定要撤销该河流事件?</p>
    </Modal>

    <Modal v-model="assModal"
           :mask-closable="false"
           title="审核分派"
           @on-ok="sendAss">
      <Form :model="assItem"
            :label-width="120">
        <Form-item label="分派的河长名"
                   prop="chief_name">
          <Input v-model="assItem.chief_name"
                 readonly />
        </Form-item>
        <Form-item label="分派的意见"
                   prop="complete_opinion">
          <Input v-model="assItem.complete_opinion"
                 readonly
                 type="textarea"
                 :autosize="true" />
        </Form-item>
        <Form-item label="是否通过审核"
                   prop="pass">
          <Checkbox v-model="assItem.pass">通过</Checkbox>
        </Form-item>
        <Form-item label="不通过的原因"
                   v-if="!assItem.pass"
                   prop="reason">
          <Input v-model="assItem.reason"
                 :maxlength="300"
                 type="textarea"
                 :autosize="true" />
        </Form-item>
      </Form>
    </Modal>
    <Modal v-model="changeModal"
           :mask-closable="false"
           title='转变为河长巡河结果'
           @on-ok="changeWechat">
      <p>确定转变为河长巡河结果</p>
    </Modal>
    <Modal v-model="iframeModal"
           :mask-closable="false"
           title='操作须知'
           width='900'>
      <iframe style="width: 100%;height: 500px;overflow-y: scroll"
              src="/static/flow.pdf"
              frameborder="0" />
    </Modal>
    <Modal v-model="printPatrolModal"
           :mask-closable="false"
           @on-ok="printPatrol"
           @on-cancel="printPdf=''"
           title="巡河记录表打印预览"
           width="1200"
           style="text-align: center">
      <iframe id="patrolTable"
              v-if="printPdf"
              style="width:100%;height:700px"
              :src="printPdf"></iframe>
      <img src="../../a-picture/img/aPictureNoCount.png"
           v-else
           height="255"
           width="340"
           alt />
      <div slot="footer">
        <Button type="primary"
                @click="printPatrol">打印</Button>
        <Button @click="printPatrolModal = false">取消</Button>
      </div>
    </Modal>
  </div>
</template>

<script>
import lc from 'public/lc';
import picture from 'public/picture';
import { ajaxPost } from 'global/axios';
import storage from 'good-storage';
import { complaintColumns } from 'common/js/table';
import depSelect from 'public/depSelect';
import areaSelect from 'public/areaSelect';
import { domain, domain2 } from 'global/setting';
import html2canvas from 'html2canvas';
export default {
  components: {
    lc,
    pictures: picture,
    'dep-select': depSelect,
    'area-select': areaSelect,
  },
  data () {
    return {
      domain2,
      urlReportNew: '/emergency/report/new',
      complaintList: '/emergency/report/list',
      urlShenHe: '/emergency/report/examine',
      urlJieSu: '/emergency/report/directover',
      urlJieSu2: '/emergency/report/submit_result',
      docList: '/emergency/report/createdoc',
      urlChangeCherf: '/emergency/report/assign',
      urlCherfList: '/sys/userinfo/findbyrole',
      urlDepList: '/sys/department/list',
      urlAssignCherf: '/emergency/report/assign_chief',
      urlAssignDep: '/emergency/report/assign_down',
      urlAssignUp: '/emergency/report/assign_up',
      urlReview: '/emergency/report/examine_result',
      urlAddressList: '/sys/department/distinct',
      urlBackDep: '/emergency/report/back_dep',
      urlHostDepList: '/sys/department/distinct',
      urlAssDep: '/emergency/report/assign_jobdep',
      urlAccept: '/emergency/report/complete',
      urlReply: '/emergency/report/reply',
      urlDel: '/emergency/report/del',
      problem_types: [],
      assignDownModal: false,
      modalDel: false,
      uploadUrl: '',
      chief_advice: '',
      backModal2: false,
      assModal: false,
      changeModal: false,
      assItem: {
        chief_name: '',
        complete_opinion: '',
        pass: true,
        reason: '',
      },
      host_dep: '',
      assist_dep: '',
      solve2: true,
      riverName: [],
      reply2: '',
      areaArr: [],
      comfirmData: [],
      solveData: [],
      completeData: [],
      fallData: [],
      reply_result: '',
      actionPage: '1',
      replay2: '',
      lcUrl: '',
      imgSrc: '',
      topTabs: '',
      chrefTabs: '',
      switch1: false,
      adviceRow: {},
      formItem2: {},
      formItem3: {},
      replay: '',
      modal1: false,
      comfirmModal1: false,
      printModal: false,
      printshow: false,
      Page: {
        current: 1,
        pageSize: 10,
        total: 0,
      },
      formItem: {},
      formItem1: {
        reason: '',
      },
      address: '',
      phone: '',
      contacts: '',
      river_name: '',
      report_time: '',
      report_no: '',
      confirm_person: '',
      is_secrecy: '',
      contacts_id: '',
      overview: '',
      complete_opinion: '',
      complete_opinion2: '',
      solve_result: '',
      row: {},
      type: '',
      mapModal: false,
      comfirmModal: false,
      comfirm: false,
      solve: false,
      type_solve_is: '',
      comfirm_num: '',
      complete_num: '',
      replyModal: false,
      complaintColumns: [],
      username1: '',
      jinduData: [],
      saveIndex: '',
      jinduColumns: [
        {
          title: '过程',
          key: 'overview',
        },
        {
          title: '时间',
          key: 'date_time',
        },
      ],
      uploadList: [],
      solve_result2: '',
      showImgLoad: [],
      username: '',
      dep_name: '',
      cherfModal: false,
      userList: [],
      depList: [],
      saveRow: {},
      backModal: false,
      companyModal: false,
      check: false,
      reason: '',
      visible: false,
      imgName: '',
      searchItem: {
        river_name: '',
        contacts: '', // 事件上报人
        report_time: [],
        deps: [],
        report_no: '',
        user_type: '',
        overday: '',
        is_multiple: false,
        my_respon: true,
        areas: '',
      },
      advice: '',
      savePhotos: [],
      host_depList: [],
      daibanNum: '',
      level: '',
      chref_complete_opinion: '',
      tuisongModal: false,
      tsRiverList: [],
      tsTypeList: [
        {
          title: '杂物漂浮',
        },
        {
          title: '污水直排',
        },
        {
          title: '水体异样',
        },
        {
          title: '护岸损毁',
        },
        {
          title: '非法采砂',
        },
        {
          title: '侵占河道',
        },
        {
          title: '非法捕鱼',
        },
        {
          title: '其他',
        },
      ],
      ts_river: '',
      ts_type: '',
      score: {},
      user_type: '',
      userType: storage.session.get('type'),
      userLevel: storage.session.get('level'),
      iframeModal: false,

      comfirmForm: { // 处理结果Modal
        solve_result: '', // 处理结果
        photos: [], // 上传图片
        reason: '' // 不通过原因
      },
      comfirmRules: { // 校验规则
        solve_result: [{ required: true, message: '请输入处理结果', trigger: 'blur' }],
        photos: [{
          required: true,
          type: 'array',
          message: '请上传图片',
          trigger: 'change'
        }]
      },
      printPdf: '',
      printPatrolModal: false,
    };
  },
  methods: {
    bb (name) {
      if (name === '上报河长') {
        this.username = '';
        this.complete_opinion2 = '';
      } else if (name === '指派河长办') {
        this.dep_name = '';
      }
    },
    newReport () {
      if (!this.formItem3.type) {
        this.$Message.error('请选择投诉类型');
        return false;
      }
      let river_name = '';
      this.riverName.map(item => {
        if (item.river_no === this.formItem3.river_name) {
          river_name = item.river_name;
        }
      });
      let params = {
        data: {
          river_name,
          river_no: this.formItem3.river_name,
          dep_name: this.formItem3.dep_name,
          report_time: this.formItem3.report_time,
          address: this.formItem3.address,
          overview: this.formItem3.overview,
          user_type: this.formItem3.type,
          phone: this.formItem3.phone,
          contacts: this.formItem3.contacts,
          contacts_id: this.formItem3.contacts_id,
          is_secrecy: '否',
        },
        url: this.urlReportNew,
        token: storage.session.get('token'),
        success: res => {
          if (res.data.code === '0000') {
            this.$Message.success({
              content: '录入成功',
            });
            this.$refs.JNoteForm.resetFields();
            this.formItem3 = {
              contacts: '',
              phone: '',
              river_name: '',
              dep_name: '',
              report_time: '',
              contacts_id: '',
              address: '',
              type: '',
              overview: '',
            };
          } else {
            this.$Message.warning({
              content: res.data.message,
            });
          }
        },
      };
      if (this.switch1) {
        params.data.is_secrecy = '是';
      }
      ajaxPost(params);
    },
    changeHzb (data, row) {
      let params = {
        data: {
          _id: row._id,
          report_no: row.report_no,
          dep_name: data,
        },
        url: this.urlChangeCherf,
        token: storage.session.get('token'),
        success: res => {
          if (res.data.code === '0000') {
            this.$Message.success({
              content: res.data.message,
            });
            if (this.actionPage === '') {
              this.getComplaint('1', this.type_solve_is);
            } else {
              this.getComplaint(this.actionPage, this.type_solve_is);
            }
          } else {
            this.$Message.warning({
              title: res.data.message,
            });
          }
        },
      };
      ajaxPost(params);
    },
    aa (name) {
      if (name === '手动录入投诉') {
        this.formItem3 = {
          contacts: '',
          phone: '',
          river_name: '',
          dep_name: [],
          contacts_id: '',
          address: '',
          type: '',
          overview: '',
        };
        this.switch1 = false;
        this.getAddress(); // 选择的部门列表
        this.getRiver(); // 河湖名称（河段）列表
        return;
      } else {
        this.$refs.JNoteForm.resetFields();
      }
      this.getComplaint('1', name);
    },
    showMap (row) {
      this.mapModal = true;
      this.$nextTick(() => {
        let center = new qq.maps.LatLng(row.lat, row.lng);
        let center2 = new qq.maps.LatLng(row.con_lat, row.con_lng);
        let map = new qq.maps.Map(document.getElementById('map'), {
          center,
          zoom: 16,
          disableDoubleClickZoom: false,
        });
        let marker = new qq.maps.Marker({
          position: center,
          map,
        });
        let marker2 = new qq.maps.Marker({
          position: center2,
          map,
        });
        let anchor = new qq.maps.Point(0, 39);
        let size = new qq.maps.Size(42, 68);
        let origin = new qq.maps.Point(0, 0);
        let markerIcon = new qq.maps.MarkerImage(
          '../../../../static/img/gis1.png',
          size,
          origin,
          anchor
        );
        let anchor2 = new qq.maps.Point(0, 39);
        let size2 = new qq.maps.Size(42, 68);
        let origin2 = new qq.maps.Point(0, 0);
        let markerIcon2 = new qq.maps.MarkerImage(
          '/static/img/weizhi.png',
          size2,
          origin2,
          anchor2
        );
        marker2.setIcon(markerIcon);
        marker.setIcon(markerIcon2);
      });
    },
    getComplaint (page = 1, type) {
      let that = this;
      let params = {};
      params.data = {};
      params.data.page = page;
      params.data.pageSize = this.Page.pageSize;
      params.data.order = { report_time: -1 }; // 按时间排序，-1表示倒序
      // params.data.order = { plan_time: -1 }; // 按计划时间排序，-1表示倒序
      params.data.searchValue = { river_name: '测试河|#|ne' };
      params.data.searchValue.solve_is = type;
      this.type_solve_is = type;
      params.token = storage.session.get('token');
      params.url = this.complaintList;
      if (this.searchItem.river_name !== '') {
        params.data.searchValue.river_name = `${this.searchItem.river_name}|#|like`;
      }
      if (this.searchItem.contacts !== '') {
        params.data.searchValue[
          'contacts'
        ] = `${this.searchItem.contacts}|#|like`;
      }
      if (this.searchItem.report_time.length != 0) {
        params.data.searchValue.report_time = `${this.searchItem.report_time[0]} 00:00:00|#|${this.searchItem.report_time[1]} 23:59:59`;
      }
      if (this.searchItem.deps != '') {
        params.data.searchValue[
          'location.dep_name'
        ] = `${this.searchItem.deps}|#|like`;
      }
      if (this.searchItem.report_no !== '') {
        params.data.searchValue.report_no = `${this.searchItem.report_no}|#|like`;
      }
      if (this.searchItem.user_type !== '') {
        params.data.searchValue.user_type = this.searchItem.user_type;
      }
      if (this.searchItem.solve_way !== '') { // 处理方式
        params.data.searchValue.solve_way = this.searchItem.solve_way;
      }
      if (this.searchItem.overday !== '') {
        params.data.searchValue.over_day = parseInt(this.searchItem.overday);
      }
      if (this.searchItem.is_multiple === true) {
        params.data.searchValue.is_multiple = '1';
      }
      if (this.searchItem.my_respon === true) {
        params.data.basis = 1;
      }
      if (
        this.searchItem.areas !== undefined &&
        this.searchItem.areas.name !== undefined
      ) {
        if (this.searchItem.areas.level == '2') {
          params.data.searchValue['location.area'] = this.searchItem.areas.name;
        } else if (this.searchItem.areas.level == '3') {
          params.data.searchValue['location.town'] = this.searchItem.areas.name;
        }
      }
      params.success = function (res) {
        that.$Loading.finish();
        if (type == '处理中') {
          //     let today = new Date().format('yyyy-MM-dd');
          // if (today > row.plan_time) {
          //   return 'bg-red';
          // }
          let firstData = [];
          let secondData = [];
          let today = new Date().format('yyyy-MM-dd');
          res.data.result.result.forEach(item => {
            today > item.plan_time
              ? firstData.push(item)
              : secondData.push(item);
          });

          that.comfirmData = [...firstData, ...secondData];
          that.comfirm_num = res.data.result.totalSize;
        } else if (type == '已处理') {
          that.completeData = res.data.result.result;
        }
        that.Page.total = res.data.result.totalSize;
        that.addBadge();
      };
      ajaxPost(params);
    },
    changePage (page) {
      this.getComplaint(page, this.type_solve_is);
      this.actionPage = page;
    },
    send () {
      let that = this;
      let params = {};
      params.data = {};
      if (this.type === '1') {
        params.data.complete_opinion = this.complete_opinion2;
        params.url = this.urlShenHe;
      }
      if (this.type === '2') { // 直接处理
        if (this.comfirmForm.solve_result === '') {
          this.$Notice.warning({
            title: '请输入处理结果',
          });
          return;
        }
        params.data.solve_result = this.comfirmForm.solve_result;
        params.data.solve_file = [];
        this.uploadList.map(item => {
          params.data.solve_file.push(item.url);
        });
        params.url = this.urlJieSu;
      }
      if (this.type === '3') { // 提交处理结果
        if (this.comfirmForm.solve_result === '') {
          this.$Notice.warning({
            title: '请输入处理结果',
          });
          return;
        } else if (this.comfirmForm.photos.length === 0) {
          this.$Notice.warning({
            title: '请上传图片',
          });
          return;
        }
        params.data.solve_file = [];
        params.data.reply_result = this.comfirmForm.solve_result;
        this.uploadList.map(item => {
          params.data.solve_file.push(item.url);
        });
        params.url = this.urlReply;
      }
      params.data._id = this.row._id;
      params.token = storage.session.get('token');
      params.success = function (res) {
        if (res.data.code == '0000') {
          that.$Message.success({
            content: res.data.message,
          });
          if (that.actionPage === '') {
            that.getComplaint('1', that.type_solve_is);
          } else {
            that.getComplaint(that.actionPage, that.type_solve_is);
          }
          that.complete_opinion2 = '';
          that.comfirmModal = false;
        } else {
          that.$Notice.warning({
            title: res.data.message,
          });
        }
      };
      ajaxPost(params);
    },
    print (row, type) {
      if (type == '1') {
        this.printshow = true;
      } else {
        this.printshow = false;
      }
      if (row.solve_file) {
        this.showImgLoad = row.solve_file.filter(file => { // 去除空值
          return file !== null && file !== undefined;
        });
        this.reply_result = row.reply_result;
      } else {
        this.showImgLoad = [];
        this.reply_result = '';
      }
      if (row.score) {
        this.score = row.score;
      } else {
        this.score = {
          speed: 0,
          attitude: 0,
          merge: 0,
          evaluate: '',
        };
      }
      this.problem_types = row.problem_types || [];
      this.user_type = row.user_type;
      this.jinduData = row.records;
      this.printModal = true;
      this.address = row.address;
      this.phone = row.phone;
      this.contacts = row.contacts;
      this.river_name = row.river_name;
      this.report_time = row.report_time;
      this.report_no = row.report_no;
      this.confirm_person = '河长办';
      this.is_secrecy = row.is_secrecy;
      this.contacts_id = row.contacts_id;
      this.overview = row.overview;
      this.complete_opinion = row.complete_opinion;
      this.solve_result = row.solve_result;
      if (row.overseer !== undefined) {
        this.advice = row.overseer.advice;
      } else {
        this.advice = '';
      }
    },
    ok () {
      let that = this;
      let params = {};
      params.data = {
        address: this.address,
        phone: this.phone,
        contacts: this.contacts,
        river_name: this.river_name,
        report_time: this.report_time,
        report_no: this.report_no,
        confirm_person: this.confirm_person,
        overview: this.overview,
        complete_opinion: this.complete_opinion,
        contacts_id: this.contacts_id,
      };
      params.url = this.docList;
      params.token = storage.session.get('token');
      params.success = function (res) {
        that.$Message.success({
          content: res.data.message,
        });
        window.open(res.data.result);
      };
      ajaxPost(params);
    },
    showModal (row, type) {
      this.row = row;
      this.type = type;
      this.solve_result2 = '';
      this.comfirmForm.solve_result = '';
      this.comfirmForm.photos = [];
      this.comfirmModal = true;
      if (type == '2' || type == '3') { // 直接处理 || 提交处理结果
        this.solve = true;
        this.check = false;
        this.solve2 = false;
        this.uploadUrl = `${domain}/filemanage/uploadphoto?dir=reportPhoto/solveFile/${row.report_no
          }&token=${storage.session.get('token')}`;
        setTimeout(() => {
          this.uploadList = this.$refs.upload.fileList;
          if (this.$refs.upload.fileList.length > 0) {
            this.$refs.upload.clearFiles();
            this.uploadList = this.$refs.upload.fileList;
          }
        }, 200);
      }
      if (type == '4') {
        this.solve = false;
        this.check = true;
        this.solve2 = false;
        this.solve_result2 = row.solve_result;
        this.uploadList = row.solve_file;
      }
    },
    addBadge () {
      let that = this;
      $('.ivu-tabs-tab:eq(0)').html('处理中');
      if (that.comfirm_num == '') {
        $('.ivu-tabs-tab:eq(0)').append("<sup class='ivu-badge-count'>0</sup>");
      } else {
        $('.ivu-tabs-tab:eq(0)').append(
          `<sup class='ivu-badge-count'>${that.comfirm_num}</sup>`
        );
      }
    },
    getAddress () {
      let that = this;
      let params = {
        data: {
          searchValue: {
            type: '0',
          },
          fieldName: 'dep_name',
          type: 'String',
        },
        token: storage.session.get('token'),
        url: this.urlAddressList,
        success: res => {
          this.areaArr = res.data.result;
        },
      };
      if (storage.session.get('level') == '2') {
        params.data.searchValue.level2 = storage.session.get('dep_name');
      }
      ajaxPost(params);
    },
    handleRemove (file) {
      const fileList = this.$refs.upload.fileList;
      this.$refs.upload.fileList.splice(fileList.indexOf(file), 1);
      this.comfirmForm.photos.splice(fileList.indexOf(file), 1);
    },
    handleSuccess (res, file) {
      file.url = res.result.path;
      file.name = res.result.filename;
      this.comfirmForm.photos.push(res.result.path);
    },
    handleFormatError (file) {
      this.$Notice.warning({
        title: '文件格式不正确',
        desc: `文件格式不正确，请上传 jpg 或 png 格式的图片。`,
      });
    },
    handleMaxSize (file) {
      this.$Notice.warning({
        title: '超出文件大小限制',
        desc: `文件太大，不能超过 20M。`,
      });
    },
    handleBeforeUpload () {
      const check = this.$refs.upload.fileList.length < 7;
      if (!check) {
        this.$Notice.warning({
          title: '最多只能上传 7 张图片。',
        });
      }
      return check;
    },
    getTongJiUser (type) {
      let params = {
        data: {
          dep_name: this.saveRow.location.dep_name,
        },
        url: this.urlCherfList,
        token: storage.session.get('token'),
        success: res => {
          this.userList = res.data.result;
          this.$Loading.finish();
        },
      };
      if (this.level == '3' && type === 0) {
        params.data.user_type = '0';
      } else if (this.level == '3' && type !== 0) {
        params.data.user_type = '1';
      } else {
        params.data.type = '2';
      }
      ajaxPost(params);
    },
    getXiaSuDep () {
      let params = {
        data: {
          searchValue: {
            level: parseInt(this.saveRow.location.level) + 1,
          },
        },
        url: this.urlDepList,
        token: storage.session.get('token'),
        success: res => {
          this.depList = res.data.result.result;
          this.$Loading.finish();
        },
      };
      if (this.saveRow.location.level == '1') {
        params.data.searchValue.level1 = this.saveRow.location.dep_name;
      } else if (this.saveRow.location.level == '2') {
        params.data.searchValue.level2 = this.saveRow.location.dep_name;
      } else if (this.saveRow.location.level == '3') {
        params.data.searchValue.level3 = this.saveRow.location.dep_name;
      }
      ajaxPost(params);
    },

    assignDown () {
      let params = {
        data: {
          _id: this.saveRow._id,
          report_no: this.saveRow.report_no,
          dep_name: this.dep_name,
        },
        url: this.urlAssignDep,
        token: storage.session.get('token'),
        success: res => {
          if (res.data.code === '0000') {
            this.$Message.success({
              content: '下派成功',
            });
            this.$Loading.finish();
            this.getComplaint('1', this.type_solve_is);
            this.assignDownModal = false;
          } else {
            this.$Message.warning({
              content: `${res.data.message}下派失败`,
            });
          }
        },
      };
      ajaxPost(params);
    },

    assign () {
      console.log(this.dep_name);
      // let params = {
      //   data: {
      //     _id: this.saveRow._id,
      //     report_no: this.saveRow.report_no,
      //     username: this.username,
      //     complete_opinion: this.complete_opinion2,
      //   },
      //   url: this.urlAssignCherf,
      //   token: storage.session.get('token'),
      //   success: res => {
      //     if (res.data.code === '0000') {
      //       this.$Message.success({
      //         content: '上报成功',
      //       });
      //       this.$Loading.finish();
      //       this.getComplaint('1', this.type_solve_is);
      //       this.cherfModal = false;
      //     } else {
      //       this.$Message.warning({
      //         content: `${res.data.message}上报失败`,
      //       });
      //     }
      //   },
      // };
      // if (this.dep_name !== '' && this.dep_name !== undefined) {
      //   params = {
      //     data: {
      //       _id: this.saveRow._id,
      //       report_no: this.saveRow.report_no,
      //       dep_name: this.dep_name,
      //     },
      //     url: this.urlAssignDep,
      //     token: storage.session.get('token'),
      //     success: res => {
      //       if (res.data.code === '0000') {
      //         this.$Message.success({
      //           content: '指派成功',
      //         });
      //         this.$Loading.finish();
      //         this.getComplaint('1', this.type_solve_is);
      //         this.cherfModal = false;
      //       } else {
      //         this.$Message.warning({
      //           content: `${res.data.message}指派失败`,
      //         });
      //       }
      //     },
      //   };
      // }
      ajaxPost(params);
    },

    accept () {
      console.log(this.dep_name);
      let params = {
        data: {
          _id: this.saveRow._id,
        },
        url: this.urlAccept,
        token: storage.session.get('token'),
        success: res => {
          if (res.data.code === '0000') {
            this.$Message.success({
              content: '受理成功',
            });
            this.$Loading.finish();
            this.getComplaint('1', this.type_solve_is);
            this.cherfModal = false;
          } else {
            this.$Message.warning({
              content: `${res.data.message}受理失败`,
            });
          }
        },
      };
      ajaxPost(params);
    },

    backDep () {
      let params = {
        data: {
          _id: this.saveRow._id,
          report_no: this.saveRow.report_no,
          reason: this.formItem1.reason,
        },
        url: this.urlBackDep,
        token: storage.session.get('token'),
        success: res => {
          if (res.data.code === '0000') {
            this.$Message.success({
              content: '撤销成功',
            });
            this.$Loading.finish();
            this.getComplaint('1', this.type_solve_is);
            this.backModal = false;
          } else {
            this.$Message.warning({
              content: `${res.data.message}撤销失败`,
            });
          }
        },
      };
      ajaxPost(params);
    },
    backDep2 () {
      let params = {
        data: {
          _id: this.saveRow._id,
          report_no: this.saveRow.report_no,
          reason: this.formItem1.reason,
        },
        url: this.urlAssignUp,
        token: storage.session.get('token'),
        success: res => {
          if (res.data.code === '0000') {
            this.$Message.success({
              content: '返回成功',
            });
            this.$Loading.finish();
            this.getComplaint('1', this.type_solve_is);
            this.backModal2 = false;
          } else {
            this.$Message.warning({
              content: `${res.data.message}返回失败`,
            });
          }
        },
      };
      ajaxPost(params);
    },
    review (type) {
      let params = {
        data: {
          _id: this.row._id,
          report_no: this.row.report_no,
        },
        url: this.urlReview,
        token: storage.session.get('token'),
        success: res => {
          if (res.data.code === '0000') {
            this.$Message.success({
              content: '操作成功',
            });
            this.$Loading.finish();
            this.getComplaint('1', this.type_solve_is);
            this.comfirmModal = false;
          } else {
            this.$Message.warning({
              content: `${res.data.message}操作失败`,
            });
          }
        },
      };
      if (type === 'true') {
        params.data.pass = true;
      } else if (type === 'false') {
        params.data.pass = false;
        params.data.solve_file = this.row.solve_file;
        params.data.solve_result = this.row.solve_result;
        params.data.solve_time = this.row.solve_time;
        params.data.reason = this.reason;
      }
      ajaxPost(params);
    },
    handleView (name) {
      this.imgName = name;
      this.visible = true;
    },
    rowClassName (row) {
      let today = new Date().format('yyyy-MM-dd');
      if (today > row.plan_time) {
        return 'bg-red';
      }
      if (row.is_multiple == '1') {
        return 'bg-orange';
      }
    },
    change (data) {
      if (data[0] === '') {
        this.searchItem.report_time = [];
        return;
      }
      this.searchItem.report_time = data;
    },
    examine () {
      let params = {
        data: {
          _id: this.saveRow._id,
          report_no: this.saveRow.report_no,
          username: this.username1,
          complete_opinion: this.chref_complete_opinion,
        },
        url: '/emergency/report/chief_process',
        token: storage.session.get('token'),
        success: res => {
          if (res.data.code == '0000') {
            this.$Message.success({
              content: '提交处理意见成功',
            });
            this.$Loading.finish();
            this.getComplaint('1', this.type_solve_is);
            this.comfirmModal1 = false;
          } else {
            this.$Message.warning({
              content: `${res.data.message}操作失败`,
            });
          }
        },
      };
      ajaxPost(params);
    },

    reply () {
      let params = {
        data: {
          _id: this.saveRow._id,
          reply_result: this.reply2,
          solve_file: ['文件1地址', '文件2地址'], //required
        },
        url: this.urlReply,
        token: storage.session.get('token'),
        success: res => {
          if (res.data.code == '0000') {
            this.$Message.success({
              content: '回复处理结果成功',
            });
            this.$Loading.finish();
            this.getComplaint('1', this.type_solve_is);
          } else {
            this.$Message.warning({
              content: `${res.data.message}操作失败`,
            });
          }
        },
      };
      ajaxPost(params);
    },

    confirmDel () {
      let params = {
        data: {
          report_no: this.saveRow.report_no,
        },
        url: this.urlDel,
        token: storage.session.get('token'),
        success: res => {
          if (res.data.code == '0000') {
            this.$Message.success({
              content: '撤销成功',
            });
            this.$Loading.finish();
            this.getComplaint('1', this.type_solve_is);
          } else {
            this.$Message.warning({
              content: `${res.data.message}操作失败`,
            });
          }
        },
      };
      ajaxPost(params);
    },

    getRiver () {
      let params = {
        data: {
          fieldName: ['river_name', 'river_no', 'area'],
        },
        url: '/bsi/riverchief/list',
        token: storage.session.get('token'),
        success: res => {
          this.riverName = res.data.result.result;
        },
      };
      ajaxPost(params);
    },
    getDepData (data) {
      if (data === undefined) {
        this.searchItem.deps = '';
      } else {
        this.searchItem.deps = data;
      }
    },
    shenheAss (row) {
      this.assModal = true;
      this.assItem.chief_name = row.respon_chief.realname;
      this.assItem.complete_opinion = row.complete_opinion;
      this.assItem.pass = true;
      this.assItem.reason = '';
      this.saveRow = row;
    },
    sendAss () {
      let params = {
        data: {
          report_no: this.saveRow.report_no,
          pass: this.assItem.pass,
        },
        url: '/emergency/report/examine_assign',
        token: storage.session.get('token'),
        success: res => {
          if (res.data.code == '0000') {
            this.$Message.success({
              content: '审核成功',
            });
            this.$Loading.finish();
            this.getComplaint('1', this.type_solve_is);
          } else {
            this.$Message.warning({
              content: `${res.data.message}操作失败`,
            });
          }
        },
      };
      if (!this.assItem.pass) {
        params.data.reason = this.assItem.reason;
      }
      ajaxPost(params);
    },
    getAreaData (data) {
      this.searchItem.areas = data;
    },
    changeWechat () {
      let params = {
        data: {
          _id: this.saveRow._id,
        },
        url: '/emergency/report/toevent',
        token: storage.session.get('token'),
        success: res => {
          if (res.data.code == '0000') {
            this.$Message.success({
              content: '转变成功',
            });
            this.$Loading.finish();
            this.getComplaint('1', this.type_solve_is);
          } else {
            this.$Message.warning({
              content: `${res.data.message}操作失败`,
            });
          }
        },
      };
      ajaxPost(params);
    },
    tuisong (row) {
      this.saveRow = row;
      this.tuisongModal = true;
      this.ts_type = '';
      this.ts_river = '';
    },
    getTsRiver () {
      const params = {
        url: '/bus/province/listriver',
        token: storage.session.get('token'),
        success: res => {
          this.tsRiverList = res.data.result.result;
        },
      };
      ajaxPost(params);
    },
    sendToPro () {
      const params = {
        data: {
          _id: this.saveRow._id,
          type: this.ts_type,
          river_code: this.ts_river,
        },
        url: '/emergency/report/pushprovince',
        token: storage.session.get('token'),
        success: res => {
          if (res.data.code == '0000') {
            this.$Message.success({
              content: '推送成功',
            });
            this.$Loading.finish();
            this.getComplaint('1', this.type_solve_is);
          } else {
            this.$Message.warning({
              content: `${res.data.message}操作失败`,
            });
          }
        },
      };
      ajaxPost(params);
    },
    drawImg () {
      let that = this;
      html2canvas($('#printModal').parent()[0]).then(function (canvas) {
        let url = canvas.toDataURL();
        let a = document.createElement('a');
        a.href = url;
        a.download = `${that.report_time.substr(0, 10)}${that.river_name
          }事件详情，编号${that.report_no}`;
        a.click();
      });
    },
    getHostDep () {
      let params = {
        data: {
          searchValue: {
            level: parseInt(storage.session.get('level')),
            type: '1',
          },
          type: 'String',
          fieldName: 'dep_name',
        },
        url: this.urlHostDepList,
        token: storage.session.get('token'),
        success: res => {
          this.host_depList = res.data.result;
          this.$Loading.finish();
        },
      };
      ajaxPost(params);
    },
    assDep () {
      if (this.host_dep === '') {
        this.$Message.warning({
          content: '请选取主办单位',
        });
      } else {
        let params = {
          data: {
            host_dep: this.host_dep,
            assist_dep: this.assist_dep,
            _id: this.saveRow._id,
            chief_advice: this.chief_advice,
          },
          url: this.urlAssDep,
          token: storage.session.get('token'),
          success: res => {
            if (res.data.code === '0000') {
              this.$Message.success({
                content: '指派成功',
              });
              this.$Loading.finish();
              this.getComplaint('1', this.type_solve_is);
              this.companyModal = false;
            } else {
              this.$Message.warning({
                content: `${res.data.message}指派失败`,
              });
            }
          },
        };
        ajaxPost(params);
      }
    },
    // 打印巡河记录表
    printPatrol () {
      let iframe = document.getElementById('patrolTable');
      iframe.contentWindow.focus();
      iframe.contentWindow.print();
      this.printPatrolModal = false;
    },
  },
  mounted () {
    // this.getTsRiver(); // 推送-河流列表
    this.level = storage.session.get('level');
    this.getComplaint('1', '处理中');
    // this.getAddress(); // 手动录入投诉-选择的部门列表
    this.addBadge();
    // this.getRiver(); // 手动录入投诉-河湖名称（河段）列表
    this.$Notice.open({
      title: '红色为超时事件，黄色为多次重复事件',
    });
    let that = this;
    this.complaintColumns = complaintColumns(that);
  },
  watch: {
    'searchItem.my_respon' (data) {
      this.getComplaint('1', this.type_solve_is);
    },
    'searchItem.is_multiple' (data) {
      this.getComplaint('1', this.type_solve_is);
    },
  },
};
</script>
<!--首页页面-->
<style lang="less">
.tousu {
  margin: 15px;
  .smallForm {
    width: 100%;
    display: inline-block;
  }
  .modal-pump {
    .ivu-modal-body {
      float: left;
    }
  }
  #map {
    width: 100%;
    height: 400px;
  }
  .ivu-badge-count {
    top: 0 !important;
    right: 5px !important;
  }
}

.reprotImg {
  width: 50px;
  height: 50px;
  float: left;
  margin-right: 5px;
}
.bg-red {
  color: red;
}
.bg-orange {
  color: orange;
}
</style>